<extend name="Public/base" />
<block name="body"> <script type="text/javascript" src="__STATIC__/uploadify/jquery.uploadify.min.js"></script>
<div class="main-title">
	<h2>公益捐赠</h2>
</div>
<div class="tab-wrap">
	<form action="__SELF__" method="post" class="form-horizontal">
		<input type="hidden" name="id" value="{$field.id}">
		<div class="form-item">
			<label class="item-label">公益标题:</label>
			<div class="controls"><input name="title" type="text" class="text input-large" value='{$field.title}'/></div>       
		</div>
		<div class="form-item">
			<label class="item-label">公益图片<span class="check-tips"></span></label>
			<div class="controls">
				<input type="file" id="upload_picture_file">
				<input type="hidden" name="litpic" id="cover_id" value="{$field.litpic}" />
				<div class="upload-img-box">
					<notempty name="field.litpic">
						<div class="upload-pre-item">
							<img src="__ROOT__{$field.litpic}" /><span class="btn-close" title="删除图片" onclick="$(this).parent().remove();"></span>
						</div>
					</notempty>
				</div>
			</div>
			<script type="text/javascript">
			$("#upload_picture_file").uploadify({
		        "height"          : 30,
		        "swf"             : "__STATIC__/uploadify/uploadify.swf",
		        "fileObjName"     : "download",
		        "buttonText"      : "上传图片",
		        "uploader"        : "{:U('File/uploadPicture',array('session_id'=>session_id()))}",
		        "width"           : 120,
		        'removeTimeout'	  : 1,
		        'fileTypeExts'	  : '*.jpg; *.png; *.gif;',
		        "onUploadSuccess" : uploadPicture_panel,
		        'onFallback' : function() {
		            alert('未检测到兼容版本的Flash.');
		        }
		    });
			function uploadPicture_panel(file, data){
		    	var data = $.parseJSON(data);
		    	var src = '';
		        if(data.status){
		        	src = data.url || '__ROOT__' + data.path
		        	$("#cover_id").val(data.path);
		        	$("#cover_id").parent().find('.upload-img-box').html(
		        		'<div class="upload-pre-item"><img src=" ' + src + '"/></div>'
		        	);
		        } else {
		        	updateAlert(data.info);
		        	setTimeout(function(){
		                $('#top-alert').find('button').click();
		                $(that).removeClass('disabled').prop('disabled',false);
		            },1500);
		        }
		    }
			</script>
		</div>
          <div class="form-item">
            <label class="item-label">目标金额:</label>
            <div class="controls"><input name="price" id="price" type="text" class="text input-large" value='{$field.price}'/></div>       
          </div>

          <div class="form-item">
            <label class="item-label">公益简介:</label>
            <div class="controls"><input name="info" type="text" class="text input-large" value='{$field.info}'/></div>             
          </div>
          <div class="form-item">
            <label class="item-label">公益描述:</label>
            <div class="controls">
				<label class="textarea" style="height:50px;">
					<textarea name="description">{$field.description}</textarea>
				</label>
			</div>       
          </div>

		<div class="form-item">
			<button class="btn submit-btn ajax-post" id="submit" type="submit" target-form="form-horizontal">保存</button>
			<button class="btn btn-return" onclick="javascript:history.back(-1);return false;">返 回</button>
		</div>
	</form>
</div>
</block>
